#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
#include <stdlib.h>

using namespace std;

// 传参错误 提示用户传参格式
static void Usage(string proc)
{
    cout << "Usage:\r\n\t" << proc << " signumber processid" << endl;
}
// ./mykill 2 pid
int main(int argc, char *argv[])
{
    if (argc != 3)
    {
        Usage(argv[0]);
        exit(1);
    }

    int signumber = atoi(argv[1]);
    int procid = atoi(argv[2]);

    kill(procid, signumber);
    ///////////////////////////////////////////////////////////////////////

    cout << "Start running..." << endl;
    sleep(1);

    // void abort();
    abort(); // ==> raise(6) ==> kill(getpid(), 6)

    // int raise(int __sig);
    raise(6);
    return 0;
}